In a network, a processor exclusively used for packet processing (packet processor) is used as an information processing apparatus for performing high-speed packet processing. The processor exclusively used for packet processing includes instructions exclusively used for increasing the efficiency of packet processing, a hardware accelerator, etc., and executes processes such as rewriting the packet header.
In recent years, for the purpose of reducing cost, a packet processor has been used, in which a plurality of general-purpose processor cores are installed. Because general-purpose processor cores are used, it is possible to use an operating system service such as Linux, and it is possible to develop software by a high-level language such as the C language. Furthermore, when the development environment is Linux, it is possible to perform performance analysis and debugging by using open software such as OProfile and GDB, and the design efficiency may be significantly enhanced.
However, when a sampling type profiler such as OProfile is used as a performance analysis tool, it is difficult to perform performance analysis with high precision. By the sampling type profiler, the operating system interrupts a program at regular intervals to check the program counter, and records the value of the checked program counter. After the program ends, the time taken to execute the entire program, and the time taken to execute each subroutine (function) called in the program, are checked based on the recorded values of the program counter. Accordingly, it is possible to analyze the time taken for each subroutine. In such a sampling type profiler, the shorter the interval of sampling the program counter, the higher the precision in measuring the data for performance analysis. However, when using the interrupt by the operating system, the sampling intervals are significantly larger than the CPU cycle, and therefore it is difficult to increase the precision. Although there is such a program, in the case of a sampling type profiler, there is no need to change the program, and the target program may be executed at substantially the same speed, at the time of regular operations and at the time of performance analysis.
Furthermore, in the case of a sampling type profiler, the sampling intervals are asynchronous with respect to an activation event of the program (packet arrival event, etc.), and the designer is unable to sample only the target portion that he or she wants to know. For example, when the designer wants to analyze the performance of packet processing, the sampling intervals are asynchronous with respect to the packet arrival intervals, and therefore the data that is unrelated to the target process, such as data relevant to a polling process before the packet arrives, is also needlessly included in the performance analysis data. Furthermore, in the case of a sampling type profiler, it is difficult to know the processing time of hardware other than the processor cores, i.e., the time taken for memory access and the processing time of an exclusively-used hardware accelerator.
Therefore, in the case of analyzing the performance of packet processing, and in the case of analyzing the performance including the time of memory access and the processing time of an exclusively-used hardware accelerator, code for reading the value of a performance counter is embedded in the program. However, this method has a problem in that there is a need to recompile the program by embedding the code for collecting performance analysis data in the original source code. Furthermore, there is a problem in that the program that is the target of performance evaluation, operates in a different manner from that of the original program, due to the embedded code. When the above code is inserted in a program, and the counter is accessed many times while the program is being executed, overhead of a total of approximately several hundred cycles occurs, and an accurate performance analysis is not possible.
Patent Document 1: Japanese National Publication of International Patent Application No. 2004-519769
Patent Document 2: Japanese Laid-Open Patent Publication No. H10-260869